/*
 * Copyright 2009 - sanatkumar.padhy
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *  	http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, 
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and 
 *  limitations under the License. 
 */
package com.googlecode.simplecrud.generator.db;

import java.util.ArrayList;
import java.util.List;

/**
 * This class represents a table from database
 */
public class TableMetadata {
	String tableName;
	List<ColumnMetadata> columns;
	List<ColumnMetadata> primaryKeys;

	/**
	 * @return the tableName
	 */
	public String getTableName() {
		return tableName;
	}

	/**
	 * @param tableName the tableName to set
	 */
	public void setTableName( String tableName ) {
		this.tableName = tableName;
	}

	/**
	 * @return the columns
	 */
	public List<ColumnMetadata> getColumns() {
		return columns;
	}

	/**
	 * @param columns the columns to set
	 */
	public void setColumns( List<ColumnMetadata> columns ) {
		this.columns = columns;
	}

	/**
	 * @return the primaryKeys
	 */
	public List<ColumnMetadata> getPrimaryKeys() {
		return primaryKeys;
	}

	/**
	 * @param primaryKeys the primaryKeys to set
	 */
	public void setPrimaryKeys( List<ColumnMetadata> primaryKeys ) {
		this.primaryKeys = primaryKeys;
	}

	/**
	 * @param primaryKey
	 */
	public void addPrimaryKey( ColumnMetadata primaryKey ) {
		if( primaryKeys == null ){
			primaryKeys = new ArrayList<ColumnMetadata>();
		}
		primaryKeys.add( primaryKey );
	}

	/**
	 * @param column
	 */
	public void addColumn( ColumnMetadata column ) {
		if( columns == null ){
			columns = new ArrayList<ColumnMetadata>();
		}
		columns.add( column );
	}
}
